import { BlankTipItem } from "../common/tooltip/BlankTipItem";
import { StrengthAddConfig } from "../../resource/StrengthAddConfig";
import { PetUtil } from "./info/PetUtil";
import { PetTalentAddInfo } from "../../resource/info/PetTalentAddInfo";
import { ToolTipInfo } from "../../model/ToolTipInfo";
import { Language } from "../../../../extend/language/Language";
import { GameDefConfig } from "../../resource/GameDefConfig";
import { PetColor } from "./info/PetColor";
import { NormalTooltip } from "../common/tooltip/NormalTooltip";
import { StrengthenAddInfo } from "../../resource/info/StrengthenAddInfo";
import { HTMLUtil } from "../../../../com/gengine/utils/HTMLUtil";
type int = number;
//class PetTalentTargetAddPanel
    
    export  class PetTalentTargetAddPanel extends BlankTipItem
    {
        constructor()
        {
            super(0, 0);
            return;
        }

        public updateByTalent(arg1: int, arg2: int, arg3: int): void
        {
            this._talentAddInfo = StrengthAddConfig.instance.getPetTalentAddInfo(PetUtil.getCareer(arg2), arg1);
            this._isEnable = !(this._talentAddInfo.currentAddInfo == null);
            this.toolTipData = this.getToolTipData(this._talentAddInfo, arg3);
            return;
        }

        /* internal  */getToolTipData(arg1: PetTalentAddInfo, arg2: int): ToolTipInfo
        {
            var loc3=null;
            var loc4=null;
            var loc1=[];
            var loc2=Language.getStringByParam(54715, arg2 * 400 + 1800, GameDefConfig.instance.getChineseNum(arg2 + 1), (arg2 + 1) * 400 + 1800);
            var loc5=arg1.currentAddInfo;
            var loc6=arg1.nextAddInfo;
            if (loc5) 
            {
                loc3 = (loc3 = Language.getStringByParam(54716, PetColor.getTalentColorByTalent(1, loc5.level).color, loc5.level, "#00ff00", Language.getString(30035).split(" ").join(""))) + this.getAttributeString(loc5, "#ffffff");
            }
            else 
            {
                loc3 = (loc3 = Language.getStringByParam(54716, PetColor.getTalentColorByTalent(1, loc6.level).color, loc6.level, "#7c7c7c", Language.getString(30036).split(" ").join(""))) + this.getAttributeString(loc6, "#7c7c7c");
            }
            loc1.push("<textFormat leading=\'3\'>" + loc2 + loc3 + "<textFormat>\n");
            if (loc5) 
            {
                if (loc6) 
                {
                    loc4 = (loc4 = Language.getStringByParam(54717, PetColor.getTalentColorByTalent(1, loc6.level).color, loc6.level)) + this.getAttributeString(loc6, "#7c7c7c");
                    loc1.push("<textFormat leading=\'3\'>" + loc4 + "<textFormat>");
                }
            }
            var loc7;
            return loc7 = new ToolTipInfo(NormalTooltip.ToolTipRenderType_Separate, loc1);
        }

        /* internal  */getAttributeString(arg1: StrengthenAddInfo, arg2: string): string
        {
            var loc2=null;
            var loc3=null;
            var loc4=null;
            var loc1="";
            var loc5=arg1.addInfoArray;
            var loc6=0;
            while (loc6 < loc5.length) 
            {
                loc3 = (loc2 = loc5[loc6])["name"] as string;
                loc4 = loc2["value"] as string;
                if (loc3.length != 2) 
                {
                    loc1 = loc1 + (loc3 + "    " + loc4 + "\n");
                }
                else 
                {
                    loc1 = loc1 + (loc3 + "            " + loc4 + "\n");
                }
                ++loc6;
            }
            loc1 = HTMLUtil.addColor(loc1, arg2);
            return loc1;
        }

        /* internal */ /* var */_talentAddInfo: PetTalentAddInfo;

        /* internal */ /* var */_isEnable: Boolean;
    }
